package com.smartleanx.module.hrm.dal.mysql.salarynotice;

import com.smartleanx.framework.common.pojo.PageResult;
import com.smartleanx.framework.mybatis.core.dataobject.BaseDO;
import com.smartleanx.framework.mybatis.core.mapper.BaseMapperX;
import com.smartleanx.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.smartleanx.module.hrm.controller.app.salarynotice.vo.AppSalaryNoticePageReqVO;
import com.smartleanx.module.hrm.dal.dataobject.salarynotice.SalaryNoticeDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 员工工资条通知 Mapper
 *
 * @author zhangchp
 */
@Mapper
public interface SalaryNoticeMapper extends BaseMapperX<SalaryNoticeDO> {

    default SalaryNoticeDO selectByPayrollDetailId(Long payrollDetailId){
        return selectOne(new LambdaQueryWrapperX<SalaryNoticeDO>()
                .eq(SalaryNoticeDO::getPayrollDetailId, payrollDetailId)
                .orderByDesc(BaseDO::getCreateTime));
    }

    default int deleteByPayrollDetailId(Long payrollDetailId){
        return delete(SalaryNoticeDO::getPayrollDetailId, payrollDetailId);
    }

    default PageResult<SalaryNoticeDO> selectPage(AppSalaryNoticePageReqVO reqVO) {
        return selectPage(reqVO);
    }
}